package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.CureRecordDao;
import cn.topevery.garden.entity.po.CureRecord;
import cn.topevery.garden.entity.query.CureRecordQuery;
import cn.topevery.garden.entity.vo.CureRecordVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 防治记录
 *
 * @author code-generate
 * @date 2022-02-18
 */
@Service
public class CureRecordLogic extends BaseLogic<CureRecord> {
    @Autowired
    CureRecordDao cureRecordDao;

    @Override
    public BaseEntityDao<CureRecord, Integer> getDao() {
        return cureRecordDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<CureRecordVO> listPage(CureRecordQuery query) {
        return cureRecordDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        cureRecordDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param cureRecord 实体
     */
    public void saveOrUpdate(String userId, CureRecord cureRecord){
        cureRecordDao.saveOrUpdate(userId,cureRecord);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public CureRecord getEntityByColumn(String key, String value) {
        return cureRecordDao.getEntityByColumn(key, value);
    }
}
